package com.zhang.order.controller;

import com.zhang.common.CommonResult;
import com.zhang.order.domain.Payment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @author Alger
 * @date 2021/8/17  22:34
 */
@RestController
@RequestMapping("order")
public class OrderController {
    @Autowired
    private RestTemplate restTemplate;
    public static final String PaymentSrv_URL = "http://cloud-payment-service";
    @GetMapping("list")
    public List<Payment> list(){
        return restTemplate.getForObject(PaymentSrv_URL+"/payment/list",List.class);

    }
    @GetMapping("list2")
    public List<CommonResult> list2(){
        return restTemplate.getForObject(PaymentSrv_URL+"/payment/list",List.class);
    }

}
